package com.itheima.fanshe3;

import java.lang.reflect.Method;

public class Demo02 {

    public static void main(String[] args) throws Exception {
        Singer singer = new Singer();
        Class clazz = singer.getClass();
        Method sing = clazz.getMethod("sing");
        sing.invoke(singer);

        Method dance = clazz.getMethod("dance", String.class);
        dance.invoke(singer,"只因你太美");
        Method rap = clazz.getMethod("rap");
        Object o = rap.invoke(singer);
        System.out.println(o);

        Method basketball = clazz.getMethod("basketball", int.class, int.class);
        Object o2 = basketball.invoke(singer, 10, 20);
        System.out.println(o2);


        Method show = clazz.getDeclaredMethod("show");
        show.setAccessible(true);
        show.invoke(singer);
        Method use = clazz.getDeclaredMethod("use", String.class);
        use.setAccessible(true);
        use.invoke(singer,"韩泽");
    }
}
